{template 'common/header'}
{if IMS_VERSION<1}
<link href="{MODULE_URL}/template/static/css/wq1.0.css" rel="stylesheet">
{/if}
<style>

.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{
white-space: normal;
word-wrap: break-word;
word-break: normal;
}
.we7-margin-right{margin-right: 10px;}
.we7-table>tbody>tr>td:last-child, .wechat-communication>tbody>tr>td:last-child{padding-right: 10px;}
.site-list .site-item-img img {
    width: 94px;
    height: auto;
}
</style>
<script src="{MODULE_URL}/template/static/js/mzp-packed-me.js"></script>

    <div class="we7-page-title">活动管理</div>
    <ul class="we7-page-tab">
         <li{if $_GPC['do'] == 'manage' || $_GPC['do'] == '' } class="active"{/if}><a href="{php echo $this->createWebUrl('manage');}">活动管理</a></li>
    </ul>
    <div class="we7-padding-bottom clearfix">
        <form action="./index.php" method="get" role="form" >
            <div class="input-group pull-left col-sm-4">
               <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="tyzm_diamondvote" />
            <input type="hidden" name="do" value="manage" />
                <input type="text" name="keyword" value="{$keyword}" class="form-control" placeholder="请输入活动名称"/>
                <span class="input-group-btn"><button class="btn btn-default"><i class="fa fa-search"></i></button></span>
            </div>
        </form>
        <div class="pull-right">
            <a href="{php echo url('platform/reply/post',array('m'=>'tyzm_diamondvote'));}" class="btn btn-primary  we7-margin-left">+添加活动</a>
        </div>
    </div>
 {loop $list $row}
    <table class="table we7-table table-hover site-list">

        <tr>
            <th colspan="2" class="text-left">活动名称({php echo date('Y-m-d H:i:s',$row['createtime'])})</th>
            <th class="text-left" width="120px">入口</th>
            <th class="text-left" width="180px">数据</th>
            <th class="text-left" width="200px">操作</th>
        </tr>

        <tr>
            <td class="text-left vertical-middle">
                <div class="site-item-img">
                    <img src="{media $row['thumb']}" width="100px" />
                </div>
            </td>
            <td class="text-left">
                <div class="we7-margin-bottom">
                    <p class="color-gray">名称</p>
                    <span class="color-dark">{$row['title']}</span>
                </div>
                <div class="">
                    <p class="color-gray">时间</p>
                    <a href="javascript:;" class="color-dark" >开始：{php echo date('Y-m-d H:i:s',$row['starttime'])}

                    <br>
                        结束：{php echo date('Y-m-d H:i:s',$row['endtime'])}</a>
                </div>
            </td>
            <td class="text-left">
                <div class="we7-margin-bottom" style="position: relative;">
                    <p class="color-gray">活动链接地址</p>
                    <a href="javascript:;" class="js-clip color-default" data-url="{php echo $_W['siteroot'].'app/' }{php echo $this->createMobileUrl('index',array('rid'=>$row['rid']))}"  >复制活动链接</a>

                </div>
                <div class="">
                   <p class="color-gray">活动状态</p>
                    <label>
                       {if $row['status']==0}
                       <div class="switch ng-scope" onclick="drop_confirm('您确定要开始活动吗!', '{php echo $this->createWebUrl('otherset',array('ty'=>'setstatus','rid'=>$row['rid'],'status'=>1))}');"></div>
                        {else}
                        <div class="switch ng-scope switchOn" onclick="drop_confirm('您确定要暂停活动吗？', '{php echo $this->createWebUrl('otherset',array('ty'=>'setstatus','rid'=>$row['rid'],'status'=>0))}');"></div>
                        {/if}
                    </label>
                    {if $row['status']==1}
                          <span class="label label-success">开始</span>
                        {elseif $row['status']==3}
                          <span class="label label-warning">未开始</span>
                        {elseif $row['status']==4}
                          <span class="label label-default">已结束</span>
                        {else}
                          <span class="label label-danger">已关闭</span>
                        {/if}
                </div>
            </td>
            <td class="text-left">
                <div class="we7-margin-vertical">

<p class="color-gray">参与人数：<span class="label label-primary">{$row['jointotal']}</span></p>
<p class="color-gray">投票数量：<span class="label label-info">{$row['votetotal']}</span></p>
<p class="color-gray">礼物数量：<span class="label label-success">{$row['giftcount']}元</span></p>
<p class="color-gray">浏  览  量：<span class="label label-danger">{$row['pvtotal']}</span></p>
<p class="color-gray">分  享  量：<span class="label label-warning">{$row['sharetotal']}</span></p>



                </div>

            </td>

            <td class="text-left">
                <div class="we7-margin-vertical">
                    <p class="color-gray">管理</p>
                     <a href="{php echo $this->createWebUrl('votelist',array('rid'=>$row['rid']))}" class="color-default we7-margin-right" rel="tooltip" title="投票管理"><i class="fa fa-cog"></i> 选手管理</a>

                     <a href="{php echo $this->createWebUrl('giftlist',array('rid'=>$row['rid']))}" class="color-default we7-margin-right" rel="tooltip" title="礼物订单"><i class="fa fa-archive"></i> 礼物订单</a>

                    {if $row['config']['isredpack']==1}
                    <a href="{php echo $this->createWebUrl('lottery',array('rid'=>$row['rid']))}" class="color-default we7-margin-right" rel="tooltip" title="红包管理"><i class="fa fa-bitcoin"></i> 红包管理</a>
                    {/if}
                    {if $_W['account']['level']==4 || $_W['account']['level']==3}
                    <a href="{php echo $this->createWebUrl('domainlist',array('rid'=>$row['rid']))}" class="color-default we7-margin-right" rel="tooltip" title="域名管理"><i class="fa fa-chain"></i> 域名管理</a>
                    {/if}
                </div>
                <div class="we7-margin-bottom">
                    <p class="color-gray">基础操作</p>
                    <a class="color-default we7-margin-right" rel="tooltip" href="{php echo url('platform/reply/post',array('m'=>'tyzm_diamondvote','rid'=>$row['rid']));}" title="编辑"><i class="fa fa-edit"></i> 编辑</a>
                    <a class="color-default we7-margin-right" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?删除不可恢复。', '{php echo url('platform/reply/delete',array('m'=>'tyzm_diamondvote','rid'=>$row['rid']));}');" title="删除"><i class="fa fa-times"></i> 删除</a>
                    <br/>
                    <a class="color-default we7-margin-right" rel="tooltip" href="{php echo url('platform/reply/post',array('m'=>'tyzm_diamondvote','copyid'=>$row['rid']));}" title="复制活动"><i class="fa fa-copy"></i> 复制活动</a>
                </div>

            </td>
        </tr>

    </table>
{/loop}
    <div class="pull-right">
        {$pager}
    </div>
</div>

<script>
$(function(){

    $(".check_all").click(function(){
    var checked = $(this).get(0).checked;
            $("input[type=checkbox]").attr("checked", checked);
    });
            $("input[name=deleteall]").click(function(){

    var check = $("input:checked");
            if (check.length < 1){
    err('请选择要删除的记录!');
            return false;
    }
    if (confirm("确认要删除选择的记录?")){
    var id = new Array();
            check.each(function(i){
            id[i] = $(this).val();
            });
            $.post('{php echo create_url('site/module', array('do' => 'deleteAll', 'name' => 'tyzm_diamondvote'))}', {idArr:id}, function(data){
            if (data.errno == 0)
            {
            location.reload();
            } else {
            alert(data.error);
            }


            }, 'json');
    }

    });




});
</script>
<script type="text/javascript">
    function drop_confirm(msg, url){
        if (confirm(msg)){
        window.location = url;
        }
    }
    $('.js-clip').each(function(){
        util.clip(this, $(this).attr('data-url'));
    });

</script>

{template 'common/footer'}